﻿using System.Linq;
using System.Windows;
using System.Windows.Controls;
using Foundation.ExtensionMethods;
using Foundation.FileAssotiations;
using Poet.ViewModels;

namespace Poet.Views
{
    /// <summary>
    /// Interaction logic for AssotiationView.xaml
    /// </summary>
    public partial class AssociationView 
    {
        public AssociationView()
        {
            InitializeComponent();
            Owner = Application.Current.MainWindow;
        }

        private AssociationViewModel AssotiationViewModel { get { return DataContext as AssociationViewModel; } }

        private void Selector_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            AssotiationViewModel.SelectedItems.Clear();
            AssotiationViewModel.SelectedItems.AddRange(ExtensionDataGrid.SelectedItems.Cast<FileAssociation>());
        }
    }
}
